<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function timeoutPromise(delay) {
            return new Promise((resolve, reject) => {
                setTimeout(() => {
                    resolve(delay)
                }, delay * 1000)
            })
        }
        const p1 = timeoutPromise(4)
        const p2 = timeoutPromise(3)
        const p3 = timeoutPromise(2)
        const p4 = timeoutPromise(2)
        // const p5 = 1 
        const p5 = new Promise((resolve, reject) => {
                setTimeout(() => {
                    reject(3)
                }, 5000)
            })
        // Promise.all([p1, p2, p3, p4, p5]).then(res => {
        //     console.log(res)
        // }).catch(error =>{
        //     console.log('error', error)
        // })
        // Promise.race([p1, p2, p3, p4, p5]).then(res =>{
        //     console.log(res)
        // }).catch(error => {
        //     console.log('error',error)
        // })
    </script>
</body>

</html>